﻿# Author: jumpingzp
# Email: jumpingzp@gmail.com

from django import forms
from django.core.mail import send_mail

class SendMailForm(forms.Form):
  fromaddr = forms.CharField()
  toaddr = forms.CharField()
  
  subject = forms.CharField()
  content = forms.CharField(
    max_length = 1024)
  
  def send(self):
    if not self.is_valid():
      return
    cd = self.cleaned_data
    send_mail(cd['subject'],cd['content'],cd['fromaddr'],[cd['toaddr']])
    
